Thanks to Bull Huber, Hugo J. Bartolín, Jorge Avila, Ralph Wagnitz, and Alfred Kleva for suggestions on how to delete files using avenue. I have tried most of these suggestions and am still not having any luck. So, another question has come up while in the process of trying to figure this out. Has anyone had any success changing the "file descriptors" in Windows? I'm running into a "No Free Channels" error message, which cannot be avoided no matter how diligent I am with garbage collection. As usual, ESRI was not very helpful. I'll gladly sum if anyone has input. Oh yea, I'm using AV 3.2 and Windows 2000. Thanks again, Jason Quantitative Decisions (AKA Bill Huber) wrote: > You need to remove all references to the underlying files before you can > delete them. Thus, for instance, you have to remove the tables from the > project. When that is done, you need to re-point any extant variables > (setting them NIL is one way) and call the Avenue garbage collector > (av.PurgeObjects). Only then do you have any hope of deleting the > datasets. If that fails, then sometimes simply waiting another second or > two after that (av.DelayedRun) does the trick. "Hugo J. Bartolín" wrote: > I think your problem is that the files don't get properly unlinked from the > project. So I reckon you should do the following: > > 1.- Unlink all the variables related to the files you want to delete. The > way to do this is making them equal to nil. > 2.- Purge objects to release references to the variables in memory. > 3.- Define the path of the file > 4.- Proceed to delete the file > 5.- Follow this for every single file you want to delete. > > The code would be something like this: > ________________________________________________________ > > 'Making all the variables related to the file equal to nil > > variable1 = nil > variable2 = nil > variable3 = nil > . > . > . > > 'Purging objects > > av.PurgeObjects > > FileDir = "C:\Dir1\...\...\" 'this is the full path of the file (as > string) > PathFile = (FileDir + "\filename.dbf").asFileName 'this is the file name (as > filename) > > 'Deleting the file > > if (file.Exists(PathFile )) then > if (file.CanDelete (PathFile )) then > file.Delete (PathFile ) > end > end Jorge Avila wrote: > Well, I never try to erase files with Avenue, but what I faced once was the > fact to create subdirectories from an Avenue script. The way I worked out > this situation was usina a OS batch (cdir.bat) and call it from Avenue with > the command SYSTEM.EXECUTE. The script could be something like this > > FOR EACH selem IN lFileNames > sComLine = "c:\avenue\efile.bat"+selem.TRIM > System.Execute(s_comline) > END > > and the efile.bat could be > > del %1 > > If you reffer to Avenue Help, it says that you can use commands like "dir" > "del" or things like these withou a bat, but I tried it and never works. So, > why don't you give it a try. > > I'll Yeccatl > (good luck in Nahuatl) Ralph.Wagnitz@SWFWMD.STATE.FL.US wrote: > I remember having trouble with this also the first time I programmed it. > Here is an example of what did work for me: > > defFileName = (theWorkdir.AsString + "\" + defFileSHX.AsString).AsFileName > File.Delete(defFileName) > > But the code seems similar to yours? > Hope you figure it out. Alfred Kleva wrote: > > Hi, > > You must use sistem commands like this exanple for win95 : > > system.execute("c:\win95\command.com /c mkdir c:\test") -- ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~ Jason Shields GIS Engineer NextBus Information Systems 1321 67th Street Emeryville, CA 94608 (510) 420-3115 (510) 652-0349 FAX http://www.nextbus.com ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~